<template>
  <el-main >
    <el-tabs type="border-card">

      <el-tab-pane label="文本录入">
        <el-row :gutter="10">
          <el-col :span="4">
            <v2-select v-model="splitChar"
                       placeholder="分割符"
                       :config="{
                          options: [
                              {label: '句号',value: '。'},
                           {label: '换行',value: '\n'},
                          ]
                       }"
            ></v2-select>
          </el-col>
          <el-col :span="20">
            <el-input placeholder="输入内容" v-model="text"  type="textarea" :autosize="{ minRows: 2,maxRows: 20}"></el-input>
          </el-col>
        </el-row>
        <el-row class="mar-t-10px">
          <el-button size="small" @click="splitText">分割文本</el-button>
          <el-button size="small" @click="copySplitText">复制分割文本</el-button>
        </el-row>
        <V2List :data-list="textList"></V2List>
      </el-tab-pane>
      <el-tab-pane label="json">
        <JsonText></JsonText>
      </el-tab-pane>
      <el-tab-pane label="提示词">
        <prompt ></prompt>
      </el-tab-pane>

      <el-tab-pane label="链接">
        <el-input placeholder="输入链接" v-model="link" class="input-with-select">
          <el-button slot="append" icon="el-icon-search"></el-button>
        </el-input>
        <V2List :data-list="[]"></V2List>
      </el-tab-pane>
    </el-tabs>
  </el-main>
</template>

<script>
import V2List from "./V2List";
import prompt from "./prompt";
import JsonText from "./JsonText";
import util from "utils/util";
import commons from "utils/commons";
export default {
  name: "index",
  components:{
    V2List,
    JsonText,
    prompt
  },
  data(){
    return {
      link: '' ,
      text: '',
      fileText: '',
      splitChar: "。" ,
      textList: []

    }
  },
  methods:{
    copySplitText(){

    },
    splitText(){
      let s = commons.simpleVData([
          {
            msg: '请输入分割符',
            value: this.splitChar
          },
        {
          msg: '请输入文本',
          value: this.text
        },
      ])
      if(!s.status){
        this.$message.error(s.msg);
        return ;
      }
      this.textList = this.text.split(this.splitChar)
    }
  }
}
</script>

<style scoped>

</style>